<!DOCTYPE html>
<html ng-app>
<head lang="en">
    <meta charset="UTF-8">
    <title>sample</title>
    <script type="text/javascript" src="../../lib/jquery/1.11.0/jquery.min.js"></script>
    <script type="text/javascript" src="../../lib/angularjs/1.3.0-beta.5/angular.js"></script>
</head>
<body>
<div id="test" ng-controller="TestController">
    <table>
        <tr>
            <th ng-click="f='name';rev=!rev">名字</th>
            <th ng-click="f='age'; rev=!rev">年龄</th>
            <th>Order</th>
            <th>Desc</th>
        </tr>
        <tr ng-repeat="p in data | orderBy : f : rev">
            <td>{{ p.name }}</td>
            <td>{{ p.age }}</td>
            <td>{{ f }}</td>
            <td>{{ rev }}</td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    var TestController = ["$scope", function ($scope) {
        $scope.data = [
            {name: 'B', age: 4},
            {name: 'A', age: 1},
            {name: 'D', age: 3},
            {name: 'C', age: 3},
        ];
    }];
</script>
</body>
</html>